home *** CD-ROM | disk | FTP | other *** search
- Path: magicnet.magicnet.net!gamecox
- From: gamecox@magicnet.magicnet.net (Jody Hagins)
- Newsgroups: comp.lang.c++
- Subject: Pure Virtual Destructor Question
- Date: 7 Feb 1996 18:49:14 GMT
- Organization: MagicNet, Inc.
- Message-ID: <4fas7a$7ns@comet2.magicnet.net>
- NNTP-Posting-Host: ns.magicnet.net
- X-Newsreader: TIN [version 1.2 PL2]
-
- Assume a class Foo s.t.
-
- class Foo
- {
- public:
- virtual ~Foo() = 0;
- };
-
- inline Foo::~Foo()
- {
- // do some destructor stuff
- }
-
-
- This is correct, and compiles fine. However, I get a warning:
- "foo.h", : warning: please provide an out-of-line definition: Foo::~Foo() {};
- hich is needed by derived classes
-
- Even when I make it non inline (in foo.C) I still get it. The only way
- I can think of to get around the problem is to do it right in the declaration
- itself. However, the compiler barks at both
-
- class Foo
- {
- public:
- virtual ~Foo() { /* do some stuff */ } = 0;
- };
-
- and
-
- class Foo
- {
- public:
- virtual ~Foo() = 0 { /* do some stuff */ }
- };
-
-
- Any hints???
-
- Thanks,
- -Jody
- gamecox@magicnet.net
-
-